<template>
  <div class="NewJobList">
    <div class="Position" id="NewJobBox">
      <div
        class="Position-box"
        v-for="(item, index) in jobList"
        :key="index"
        @click="handleDetails(item, index)"
      >
        <div class="Position-content-top">
          <p class="Position-name">{{ item.jobName }}</p>
          <!-- <div class="guide-app-download-icon"></div> -->
          <p class="Position-price">{{ item.salaryDesc }}</p>
        </div>
        <p class="Position-content-center">
          {{ item.cityName }}
          <span class="vline"></span>
          {{ item.jobExperience }}
          <span class="vline"></span>
          {{ item.jobDegree }}
        </p>
        <div class="Position-content-bottom">
          <p><img :src="item.brandLogo" alt="" /></p>
          <a href="###" class="Position-content-bottom-info">
            <span class="name">{{ item.brandName }}</span>
            <span class="type">{{ item.brandIndustry }}</span>
            <span class="vline"></span>
            <span class="level">已上市</span>
          </a>
        </div>
      </div>
    </div>
    <button class="position-btn" @click="NewJobListClick">查看更多</button>
  </div>
</template>

<script>
export default {
  name: 'NewJobList',
  components: {},
  data() {
    return {
      jobList: []
    }
  },
  computed: {},
  watch: {},
  created() {
    this.getJobList()
  },
  mounted() {},
  methods: {
    NewJobListClick() {
      var NewJobBox = document.getElementById('NewJobBox')
      var NewJobHeight = NewJobBox.clientHeight
      if (NewJobHeight <= 2190) {
        if (this.jobList.length % 9 !== 0) {
          NewJobBox.style.height = NewJobHeight + 146 + 'px'
        } else {
          NewJobBox.style.height = NewJobHeight + 438 + 'px'
        }
      }
      if (NewJobHeight > 2628) {
        NewJobBox.style.height = '2920px'
      }
      // console.log(NewJobHeight);
    },
    handleDetails(item, index) {
      // console.log(item,index);
      // console.log(item.encryptJobId);
      sessionStorage.setItem('jobDetail', JSON.stringify(item))
      let routeData = this.$router.resolve({
        path: '/positiondetails',
      })
      window.open(routeData.href, '_blank')
    },
    getJobList() {
      this.$request.get('/api/api/JobInfo/GetInfo').then((res) => {
        // console.log(res)
        this.jobList = res.data.reverse()
      })
      // this.$request.post('/yapi/newJobList').then((res) => {
      //   console.log(res)
      //   this.jobList = res.zpData.jobList
      // })
    },
  },
}
</script>
<style scoped>
.Position {
  width: 1184px;
  height: 438px;
  overflow: hidden;
  margin: auto;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-content: flex-start;
  flex-wrap: wrap;
  align-items: center;
}
.Position-box {
  width: 344px;
  height: 90px;
  background-color: #fff;
  margin-right: 16px;
  margin-bottom: 16px;
  padding: 20px;
  cursor: pointer;
}
.Position-box:hover {
  box-shadow: 2px 2px 20px #c7c5c5;
  transform: scale(1.01);
}
.Position-box:hover .Position-name {
  color: #55cbc4;
}
.Position > .Position-box:nth-child(3n) {
  margin-right: -10px;
}
.Position-content-top {
  display: flex;
  width: 100%;
  align-items: center;
}
.Position-name {
  position: relative;
  max-width: 200px;
  font-size: 15px;
  color: #414a60;
  margin-right: 8px;
  line-height: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* .guide-app-download-icon{
  display: inline-flex;
    width: 15px;
    height: 13px;
    background: url(../images/guide-add-download-icon.png) no-repeat;
    background-size: 100% 100%;
} */
.Position-price {
  font-size: 15px;
  color: #fd7240;
  line-height: normal;
  flex: 1;
  text-align: right;
  max-width: none;
}
.Position-content-center {
  font-size: 13px;
  color: #8d92a1;
  padding-right: 0;
  line-height: 28px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vline {
  display: inline-block;
  width: 1px;
  height: 12px;
  vertical-align: middle;
  background: #e0e0e0;
  margin: 0 10px;
}
.Position-content-bottom {
  border-top: 1px solid #eef0f5;
  display: flex;
  margin-top: 8px;
  padding-top: 12px;
}
.Position-content-bottom > p {
  font-size: 14px;
  width: auto;
  padding-right: 0;
  border: 1px solid #f3f5fb;
  border-radius: 4px;
  line-height: normal;
}
.Position-content-bottom > p > img {
  width: 30px;
  height: 30px;
}
.Position-content-bottom-info {
  font-size: 13px;
  color: #8d92a1;
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.Position-content-bottom-info > .name {
  margin-left: 10px;
  margin-right: 20px;
  color: #61687c;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.Position-content-bottom-info > .type {
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.Position-content-bottom-info > .level {
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.position-btn {
  width: 200px;
  height: 40px;
  margin-left: 50%;
  transform: translateX(-50%);
  margin-top: 50px;
  margin-bottom: 50px;
  color: #fff;
  font-size: 16px;
  background-color: #55cbc4;
  border: none;
  cursor: pointer;
  outline: none;
}
.position-btn:hover {
  background-color: #5dd5cb;
}
</style>